import type { RouteRecordRaw } from 'vue-router';

declare module 'vue-router' {
    interface RouteMeta {
        title: String,
        icon: String,
        hidden: boolean,
    }
}

export const constantRoute: RouteRecordRaw[] = [
    // 首页
    {
        name: 'layout',
        path: '/',
        meta: {
            title: '',
            icon: "Menu",
            hidden: false,
        },
        redirect: '/home',
        component: () => import('@/views/layout/index.vue'),
        children: [
            {
                name: 'home',
                path: '/home',
                meta: {
                    title: '首页',
                    icon: "HomeFilled",
                    hidden: false,
                },
                component: () => import('@/views/home/index.vue')
            },
        ]
    },
    // 大屏
    {
        name: 'screen',
        path: '/screen',
        meta: {
            title: '数据大屏',
            icon: "Platform",
            hidden: false,
        },
        component: () => import('@/views/screen/index.vue')
    },
    // 权限管理
    {
        name: "acl",
        path: "/acl",
        meta: {
            title: '权限管理',
            icon: "Lock",
            hidden: false,
        },
        component: () => import('@/views/layout/index.vue'),
        redirect: "/acl/user",
        children: [
            // 用户管理
            {
                name: "user",
                path: "/acl/user",
                meta: {
                    title: '用户管理',
                    icon: 'User',
                    hidden: false,
                },
                component: () => import('@/views/acl/user/index.vue')
            },
            // 角色管理
            {
                name: "role",
                path: "/acl/role",
                meta: {
                    title: '角色管理',
                    icon: 'UserFilled',
                    hidden: false,
                },
                component: () => import('@/views/acl/role/index.vue')
            },
            // 菜单管理
            {
                name: "permission",
                path: "/acl/permission",
                meta: {
                    title: '菜单管理',
                    icon: 'Menu',
                    hidden: false,
                },
                component: () => import('@/views/acl/permission/index.vue')
            },
        ]
    },
    // 商品管理
    {
        name: "product",
        path: "/product",
        meta: {
            title: '商品管理',
            icon: "Shop",
            hidden: false,
        },
        component: () => import('@/views/layout/index.vue'),
        redirect: "/product/trademark",
        children: [
            // 品牌管理
            {
                name: "trademark",
                path: "/product/trademark",
                meta: {
                    title: '品牌管理',
                    icon: 'Goods',
                    hidden: false,
                },
                component: () => import('@/views/product/trademark/index.vue')
            },
            // 属性管理
            {
                name: "attr",
                path: "/product/attr",
                meta: {
                    title: '属性管理',
                    icon: 'SwitchFilled',
                    hidden: false,
                },
                component: () => import('@/views/product/attr/index.vue')
            },
            // spu管理
            {
                name: "spu",
                path: "/product/spu",
                meta: {
                    title: 'SPU管理',
                    icon: 'Calendar',
                    hidden: false,
                },
                component: () => import('@/views/product/spu/index.vue')
            },
            // sku管理
            {
                name: "sku",
                path: "/product/sku",
                meta: {
                    title: 'SKU管理',
                    icon: 'Orange',
                    hidden: false,
                },
                component: () => import('@/views/product/sku/index.vue')
            },
        ]
    },
    // 登录
    {
        name: 'login',
        path: '/login',
        meta: {
            title: '登录',
            icon: "Promotion",
            hidden: true,
        },
        component: () => import('@/views/login/index.vue')
    },
    // 404错误
    {
        name: '404',
        path: '/404',
        meta: {
            title: '404',
            icon: "",
            hidden: true,
        },
        component: () => import('@/views/404/index.vue')
    },
    // 其他路由
    {
        name: 'any',
        path: '/:patMatch(.*)*',
        meta: {
            title: '任意路由',
            icon: "",
            hidden: true,
        },
        redirect: "/404"
    },
]